package org.xqp.basic.interceptor.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.xqp.basic.interceptor.LoginInterceptor;

@Configuration //  登录拦截器配置信息， 配置类
public class LoginConfigurer implements WebMvcConfigurer{

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // 拦截所有路径
                .excludePathPatterns("/login/**") // 放行登录
                .excludePathPatterns("/user/phone/register") // 放行注册
                .excludePathPatterns("/verifycode/smsCode") // 验证码放行
                .excludePathPatterns("/fastDfs/**") // 上传图片放行
                .excludePathPatterns("/shop/**");

    }
}
